/*------------------------------------------------------
| noka tab menu v1.0 www.97521.com                     |
| rebin 2014-11-28                                     |
|-----------------------------------------------------*/
var nokatabmenu = Class.create({
	    version: '1.0',
	    initialize : function(cfg) {
	    	this.id=cfg.id; //id
	    	this.cfg = cfg;
	    	this.optab = cfg.optab;
	    	this.tabs = cfg.tabs;//[{id:'',title:'',url:''},{id:'',title:'',url:''}]
	    	this.ptabs = [];
	    	this.height = (undefined != cfg.height?cfg.height:400);//高度
	    	this.lang = (undefined ==cfg.lang?{left_close:'close left',other_colse:'colse other',right_close:'close right'}:cfg.lang);
	    	this.onstart = cfg.onstart;
	    	this.onend = cfg.onend;
	    },
	    show : function(){
	    	var self = this;
	    	self.initnokatabmenu();//初始化选项卡
	    	self.inittabs();//插入初始化选项卡
	    	self.initevent();
	    },
	    //-----------初始化选项卡菜单---------------------------------------------------------
	    initnokatabmenu : function(){
	    	var self = this;
	    	var idx = 0;
	    	var html=[];
	    	html[idx++]='<div class="div_title_banner">';
	    	html[idx++]='<div id="'+self.id+'_tab_select_body_html"></div>';//选项卡右键菜单
	    	html[idx++]='<div id="'+self.id+'_div_title" class="div_title">';
	    	html[idx++]='<div class="sorc_div_title">';
	    	html[idx++]='<table border="0" cellpadding="0" cellspacing="0"  class="title_table"><tr id="'+self.id+'_tab_title_id_div"></tr></table>';// id="'+self.id+'_tab_title_id_div"></div>';//标题
	    	html[idx++]='</div>';
	    	html[idx++]='</div>';
	    	html[idx++]='<div id="'+self.id+'_tab_more_button" class="titl_clear">&gt;&gt;</div>';//更多按钮
	    	html[idx++]='</div>';
	    	html[idx++]='<div  style="clear: both;" class="line"></div>';//分隔线
	    	html[idx++]='<div id="'+self.id+'_select_body"  class="select_body" style="height:'+self.height+'px;position: absolute;display: none;z-index:99999"><div id="'+self.id+'_select_body_list" class="select_body_list"><table cellpadding="0" cellspacing="0"  id="'+self.id+'_select_table" border="0"></table></div><div id="'+self.id+'_select_closeall_buttons" class="selectall_buttons"><table id="'+self.id+'_select_closeall_buttons_table" cellpadding="0" cellspacing="0"  border="0"><tr><td><span id="'+self.id+'_selectall_buttons_left" class="left_close"  title="'+self.lang.left_close+'">&nbsp;</span></td><td><span id="'+self.id+'_selectall_buttons_mide" class="other_colse" title="'+self.lang.other_colse+'">&nbsp;</span></td><td><span id="'+self.id+'_selectall_buttons_right" class="right_close" title="'+self.lang.right_close+'">&nbsp;</span></td></tr></table></div></div>';//下拉区
	    	html[idx++]='<div id="'+self.id+'_tab_body" style="overflow:visible"></div>';//内容
	    	$(self.id).innerHTML = html.join('');
	    	if(undefined!=self.onstart){
	    		try{self.onstart();}catch(e){}
	    	}
	        self.showList();
	    },
	    //--------重设下拉框的高度------------------------------------
	    resetListHeight : function(){
	    	var self = this;
		    	var obj = $(self.id+'_tab_more_button');
		    	var tableSize = $(self.id+'_select_table').getDimensions();
		    	var minWidth = $(self.id+'_select_closeall_buttons_table').getWidth();
		    	var listBody = $(self.id+'_select_body');
		    	var listBody_list = $(self.id+'_select_body_list');
	    		var swidth = tableSize.width;
	    		var sheight=tableSize.height;//表格高度
	    		var bheight = $(self.id+'_select_closeall_buttons').getHeight();//按钮高度
	    		var Lheight = sheight;
	    		swidth = (sheight>self.height?swidth+20:swidth);
	    		swidth = (swidth < minWidth?minWidth:swidth);
	    		Lheight = (Lheight<self.height?Lheight:self.height);
	    		var atop = obj.positionedOffset().top+obj.offsetHeight;
	    		var aleft = obj.positionedOffset().left-swidth+obj.getWidth()-10;
	    		listBody.style.top=atop;
	    		listBody.style.left=aleft;
	    		listBody.setStyle({height:(Lheight+bheight+2)+'px',width:(swidth+2)+'px',left:aleft+'px',top:atop+'px'});
	    		listBody_list.setStyle({height:Lheight+'px',width:swidth+'px'});
	    		$(self.id+'_select_closeall_buttons').setStyle({width:swidth+'px'});
	    		$(self.id+'_select_table').setStyle({width:(sheight>self.height?swidth-20:swidth)+'px'});
	    },
	    //-----------显示下拉菜单------------------------------------------------------------
	    showList : function(){
	    	var self = this;
	    	var listBody = $(self.id+'_select_body');
	    	var obj = $(self.id+'_tab_more_button');
	    	var sbody = $(self.id);
	    	var miFlg = true;
	    	obj.observe('click',function(a){
	    		if(!listBody.visible()){
	    			listBody.show();
		    		self.resetListHeight();
	    		}else{
	    			listBody.hide();
	    		}
	    	});
    		obj.observe('mousemove',function(){
    	    		miFlg = true;
    	    });
    	    obj.observe('mouseout',function(event){
    	        miFlg = false;
    	        var element = event.element();
    	        setTimeout(function(){
    	        	if (element.descendantOf(sbody) && !miFlg){
    	             	listBody.hide();
    	            }
    	           }, 500);
    	        });
    	     listBody.observe('mousemove',function(){
    	    		miFlg = true;
    	    	});
    	     listBody.observe('mouseout',function(event){
    	        	miFlg = false;
    	        	var element = event.element();
    	        	setTimeout(function(){
    	                if (element.descendantOf(sbody) && !miFlg){
    	                	listBody.hide();
    	                }
    	            }, 500);
    	     });
    	     $(self.id+'_selectall_buttons_right').observe('click',function(a){//关闭右边
    	    	 self.delRightRab();
			 });
			 $(self.id+'_selectall_buttons_mide').observe('click',function(a){//关闭其它
				 //--------删除左边----------------------------------
				 self.delLeftRab();
    	    	 //-------删除右边-----------------------------------
    	    	 self.delRightRab();
			 });
			 $(self.id+'_selectall_buttons_left').observe('click',function(a){//关闭左边
				self.delLeftRab();
			 });
			 //----------------------------------------------------------
			 $(self.id).resize = function(width,height){
				 $(self.id+'_div_autowidth').setStyle({width:width+'px'});
				 $(self.id+'_div_autoheight').setStyle({height:height+'px'});
				 self.resize();
			 };
	    },
	    //----------删除左边选项卡---------------------------------------------------------------
	    delRightRab : function(){
	    	var self = this;
	    	var idx = self.ptabs.indexOf(self.optab);
	    	var dear = [];
	    	var ndx = 0;
	    	//--需要删除的---------------------------------------------------------
	    	for(var i=self.ptabs.length-1;i>idx;i--){
	    		try{
		    		if($(self.id+'_select_close_button_'+self.ptabs[i]).visible()){
		    			dear[ndx++] = self.ptabs[i];
		    		}
	    		}catch(e){}
	    	}
	    	//-----------------------------------------------------------------
	    	dear.each(function(name, index) {
	    		self.closeBody(dear[index]);
	    	});
	    },
	    //----------删除左边选项卡---------------------------------------------------------------
	    delLeftRab : function(){
	    	var self = this;
	    	var idx = self.ptabs.indexOf(self.optab);
	    	var dear = [];
	    	var ndx = 0;
	    	//--需要删除的---------------------------------------------------------
	    	for(var i=0;i<idx;i++){
	    		try{
		    		if($(self.id+'_select_close_button_'+self.ptabs[i]).visible()){
		    			dear[ndx++] = self.ptabs[i];
		    		}
	    		}catch(e){}
	    	}
	    	//-----------------------------------------------------------------
	    	dear.each(function(name, index) {
	    		self.closeBody(dear[index]);
	    	});
	    },
	    //----------初始化选项卡--------------------------------------------------------------
	    inittabs : function(){
	    	var self = this;
	    	var tabs = self.tabs;
	    	if(undefined !=tabs){
	    		for(var i=0;i<tabs.length;i++){
	    			self.insertTab(tabs[i]);
	    		}
	    	}
	    },
	    //--------------redbgrid--------------------------------------------------------
	    redbgrid : function(menuid){
	    	var self = this;
    			setTimeout(function(){
    				try{
    					$(self.id+'_body_iframe_'+menuid).contentWindow.document.fire("widget:noka_grid_resize", {});//触发控件初始事件
    				}catch(e){}
    				try{
    					$(self.id+'_body_iframe_'+menuid).contentWindow.document.fire("widget:noka_tabmenu_show", {});//触发控件初始事件
    				}catch(e){}
    			},200);
	    },
	    //--------------选种菜单-----------------------------------------------------------
	    SelectTabmenu : function(menuid){
	    	var self = this;
	    	//----------------设置标题样式--------------------------------------------------
	    	$$('div[id^="'+self.id+'_tdiv_button_"]').each(function(alink,index) {
	    		var mid =self.idtomenuid(alink.id);
	    		if(undefined!=mid && menuid==mid){
	    			alink.removeClassName('notitle_div');
	    			alink.addClassName('title_div');
	    		}else{
	    			alink.removeClassName('title_div');
		    		alink.addClassName('notitle_div');
	    		}
			});
	    	//---------------设置内容区---------------------------------------------------
	    	$$('iframe[id^="'+self.id+'_body_iframe_"]').each(function(alink,index) {
	    		var mid =self.idtomenuid(alink.id);
	    		if(undefined!=mid && menuid==mid){
	    			alink.show();
	    		}else{
	    			alink.hide();
	    		}
			});
	    	self.optab = menuid;
	    	//-------------------------------------------------------------------------
	    	try{
	    		$(self.id+'_div_title').scrollLeft=$(self.id+'_tdiv_button_'+menuid).positionedOffset().left-15;
	    	}catch(e){}
	    	//-------------------------------------------------------------------------
	    	try{
	    		$$('tr[id^="'+self.id+'_select_options_tr_"]').each(function(alink,index) {
	    			if(self.id+'_select_options_tr_'+menuid!=alink.id){
	    				alink.removeClassName('table_options_hover');
	    				alink.addClassName('table_options');
	    			}else{
	    				alink.removeClassName('table_options');
	    				alink.addClassName('table_options_hover');
	    			}
	    		});
	    	}catch(e){}
	    	//-------------------------------------------------------------------------
	    	self.rebodySize(menuid);
	    	self.redbgrid(menuid);
	    },
	    //---------------根据标题id获取选项卡id-----------------------------------------------
	    idtomenuid : function(id){
	    	if(undefined!=id){
	    		try{
	    			return id.substring(id.lastIndexOf('_')+1,id.length);
	    		}catch(e){}
	    	}
	    },
	    rebodySize : function(menuid){
	    	var self = this;
	    	try{
	    		var cwidth = $(self.id+'_div_autowidth').getWidth();
	    		var cheight =$(self.id+'_div_autoheight').getHeight();
	    		var vtop = $(self.id+'_div_title').getHeight();
	    		cheight = cheight-vtop;
	    		$(self.id+'_body_iframe_'+menuid).setStyle({width:cwidth+'px',height:cheight+'px'});
	    		$(self.id).setStyle({width:cwidth+'px',height:cheight+'px'});
	    	}catch(e){}
	    },
	    //----------------初始化事件--------------------------------------------------------
	    initevent : function(){
	    	var self = this;
	    	//-----------插入选项卡--------------------------------------------------------
	    	$(self.id).insertTab = function(a){
	    		self.insertTab(a);
	    		self.optab = a.id;
	    		self.SelectTabmenu(self.optab);//选种当前选项卡
	    	};
	    	$(self.id).insertTabs = function(a){
	    		if(undefined!=a){
	    			for(var i=0;i<a.length;i++){
	    				self.insertTab(a[i]);
	    			}
	    		}
	    		self.optab = a[a.length-1].id;
	    		self.SelectTabmenu(self.optab);//选种当前选项卡
	    	};
	    	//--------关闭-----------------------------------
	    	$(self.id).close = function(menuid){
	    		self.closeBody(menuid);
	    	};
	    	$(self.id).closeLeft = function(menuid){
	    		try{
	    			if(self.optab!=menuid){
	    				self.SelectTabmenu(menuid);
	    			}
	    		}catch(e){}
	    		self.delLeftRab();
	    	};
	    	$(self.id).closeRight = function(menuid){
	    		try{
	    			if(self.optab!=menuid){
	    				self.SelectTabmenu(menuid);
	    			}
	    		}catch(e){}
				self.delRightRab();
	    	};
	    	$(self.id).closeOther = function(menuid){
	    		try{
	    			if(self.optab!=menuid){
	    				self.SelectTabmenu(menuid);
	    			}
	    		}catch(e){}
				 self.delLeftRab();
				 self.delRightRab();
	    	};
	    	//------------窗体大小改变--------------------------
	    	Event.observe(window, 'resize', function(){
	    		self.resize();
	    	});
	    	self.resize();
	    	//-----------获取控件id---------------------------
	    	$(self.id).getId = function(){
	    		return self.id;
	    	};
	    },
	    //----------------窗体大小-----------------------------------------------------
	    resize : function(){
	    	var self = this;
	    	var titlediv = $(self.id+'_div_title');
	    	var bodyWidth = $(self.id+'_div_autowidth').getWidth()-$(self.id+'_tab_more_button').getWidth()-20;
	    	titlediv.setStyle({width:bodyWidth+'px'});
	    	self.rebodySize(self.optab);
	    },
	    //------------------插入tab---------------------------------------------------
	    insertTab : function(tab){//{id:'',title:'',url:'',close:true,refresh:true}
	    	var self = this;
	    	var title = $(self.id+'_tab_title_id_div');
	    	var body = $(self.id+'_tab_body');
	    	var selectBody = $(self.id+'_select_table');
	    	var tabBody = $(self.id+'_tdiv_button_'+tab.id);
	    	if(undefined !=tab && undefined == tabBody){
	    		title.insert('<td><div id="'+self.id+'_tdiv_button_'+tab.id+'" class="notitle_div"><span id="'+self.id+'_reload_button_'+tab.id+'" '+((undefined==tab.refresh || tab.refresh)?'':'style="display: none;"')+' class="reload_button" title="'+self.lang.reload+'">&nbsp;</span><span class="title" id="'+self.id+'_title_button_'+tab.id+'">'+tab.title+'</span><span '+((undefined==tab.close || tab.close)?'':'style="display: none;"')+'  id="'+self.id+'_close_button_'+tab.id+'" class="close">&times;</span></div></td>');//标题
	    		body.insert('<iframe id="'+self.id+'_body_iframe_'+tab.id+'" name="'+self.id+'_body_iframe_'+tab.id+'" frameborder="no" border="0" style="border: 0"  src="'+tab.url+'"></iframe>');//内容
	    		selectBody.insert('<tr class="table_options" id="'+self.id+'_select_options_tr_'+tab.id+'"><td class="item_left tabpage_image">&nbsp;</td><td style="white-space: nowrap;" class="item_right"><div style="white-space: nowrap;" id="'+self.id+'_select_options_'+tab.id+'">'+tab.title+'</div></td><td style="text-align: right;"><span '+((undefined==tab.close || tab.close)?'':'style="display: none;"')+' id="'+self.id+'_select_close_button_'+tab.id+'" class="close">&times;</span></td></tr>');//列表
	    		self.SelectTabmenu(self.optab);//选种当前选项卡
	    		self.closeEvent(tab.id);//加载关闭事件
	    		self.ptabs[self.ptabs.length]=tab.id;
	    	}
	    	if(undefined!=tab){
	    		$(self.id).show();
	    	}
	    	if(undefined!=self.onend){
	    		try{self.onend();}catch(e){}
	    	}
	    },
	    //----------------内部事件-------------------------------------------------------
	    closeEvent : function(menuid){
	    	var self = this;
	    	var closea = $(self.id+'_close_button_'+menuid);
	    	var tabbutton = $(self.id+'_title_button_'+menuid);
	    	var opbutton = $(self.id+'_select_options_'+menuid);
	    	var sopbutton = $(self.id+'_select_close_button_'+menuid);
	    	var tableTr = $(self.id+'_select_options_tr_'+menuid);
	    	var reload = $(self.id+'_reload_button_'+menuid);
	    	var tdiv = $(self.id+'_tdiv_button_'+menuid);
	    	closea.observe('click',function(a){
	    		self.closeBody(menuid);
	    	});
	    	sopbutton.observe('click',function(a){
	    		self.closeBody(menuid);
	    	});
	    	tabbutton.observe('click',function(a){
	    		self.SelectTabmenu(menuid);
	    	});
	    	opbutton.observe('click',function(a){
	    		self.SelectTabmenu(menuid);
	    	});
	    	tableTr.observe('mousemove',function(a){
	    		tableTr.removeClassName('table_options');
	    		tableTr.addClassName('table_options_hover');
	    	});
	    	tableTr.observe('mouseout',function(a){
	    		if(self.id+'_select_options_tr_'+self.optab!=tableTr.id){
	    			tableTr.removeClassName('table_options_hover');
	    			tableTr.addClassName('table_options');
	    		}
	    	});
	    	reload.observe('click',function(a){
	    		//------------------刷新------------------------------------
	    		try{
	    			var src = $(self.id+'_body_iframe_'+menuid).src;
	    			$(self.id+'_body_iframe_'+menuid).src = src;
	    		}catch(e){}
	    		//-----------------选中------------------------------------
	    		try{
	    			if(self.optab!=menuid){
	    				self.SelectTabmenu(menuid);
	    			}
	    		}catch(e){}
	    	});
	    	//----------------------------------------------------------
	    	
	    	tdiv.oncontextmenu=function(){return false;};
	    	tdiv.observe('contextmenu',function(event){
	    		Event.stop(event);
	    		self.rightMenu(menuid);
	    	});
	    	
	    },
	    //--------------右键菜单---------------------------------------------------------
	    rightMenu : function(menuid){
	    	var self = this;
	    	var idx = 0;
	    	var html = [];
	    	var miFlg = true;
	    	var reload = true;//刷新
	    	var close = true;//是否可以关闭
	    	try{
	    		reload = $(self.id+'_reload_button_'+menuid).visible();
	    	}catch(e){}
	    	try{
	    		close = $(self.id+'_close_button_'+menuid).visible();
	    	}catch(e){}
	    	html[idx++]='<div id="'+self.id+'_tab_select_body_'+menuid+'"  class="select_body" style="position: absolute;display: none;z-index:99999">';//下拉区
	    	html[idx++]='<table cellpadding="0" cellspacing="0"  id="'+self.id+'_tab_select_table" border="0">';
	    	html[idx++]='<tr id="'+self.id+'_tab_select_body_tr_reload_'+menuid+'" '+(reload?'':'style="display: none;"')+'  class="table_options"><td class="item_left reload_image">&nbsp;</td><td class="item_right" id="'+self.id+'_tab_select_body_reload_'+menuid+'" >'+self.lang.reload+'</td></tr>';//刷新
	    	html[idx++]='<tr id="'+self.id+'_tab_select_body_tr_myclose_'+menuid+'" '+(close?'':'style="display: none;"')+' class="table_options"><td class="item_left down_image">&nbsp;</td><td  class="item_right" id="'+self.id+'_tab_select_body_myclose_'+menuid+'" >'+self.lang.my_close+'</td></tr>';//关闭自己
	    	html[idx++]='<tr id="'+self.id+'_tab_select_body_tr_leftclose_'+menuid+'" class="table_options"><td class="item_left leftclose_image">&nbsp;</td><td  class="item_right" id="'+self.id+'_tab_select_body_leftclose_'+menuid+'" >'+self.lang.left_close+'</td></tr>';//关闭左边
	    	html[idx++]='<tr id="'+self.id+'_tab_select_body_tr_otherclose_'+menuid+'" class="table_options"><td class="item_left ortherclose_image">&nbsp;</td><td  class="item_right" id="'+self.id+'_tab_select_body_otherclose_'+menuid+'" >'+self.lang.other_colse+'</td></tr>';//关闭其它
	    	html[idx++]='<tr id="'+self.id+'_tab_select_body_tr_rightclose_'+menuid+'" class="table_options"><td class="item_left rightclose_image">&nbsp;</td><td  class="item_right" id="'+self.id+'_tab_select_body_rightclose_'+menuid+'" >'+self.lang.right_close+'</td></tr>';//关闭右边
	    	html[idx++]='</table></div>';
	    	$(self.id+'_tab_select_body_html').innerHTML = html.join('');
	    	//--------------刷新--------------------------------------------------------
	    	$(self.id+'_tab_select_body_reload_'+menuid).observe('click',function(a){
	    		//------------------刷新------------------------------------
	    		try{
	    			var src = $(self.id+'_body_iframe_'+menuid).src;
	    			$(self.id+'_body_iframe_'+menuid).src = src;
	    		}catch(e){}
	    		//-----------------选中------------------------------------
	    		try{
	    			if(self.optab!=menuid){
	    				self.SelectTabmenu(menuid);
	    			}
	    		}catch(e){}
	    		try{
	    			$(self.id+'_tab_select_body_'+menuid).hide();
	    		}catch(e){}
	    	});
	    	//--------------关闭自己------------------------------------------------------
			$(self.id+'_tab_select_body_myclose_'+menuid).observe('click',function(a){
				self.closeBody(menuid);
				try{
	    			$(self.id+'_tab_select_body_'+menuid).hide();
	    		}catch(e){}
			});
			//---------------关闭左边------------------------------------------------------
			$(self.id+'_tab_select_body_leftclose_'+menuid).observe('click',function(a){
				try{
	    			if(self.optab!=menuid){
	    				self.SelectTabmenu(menuid);
	    			}
	    		}catch(e){}
	    		self.delLeftRab();
	    		try{
	    			$(self.id+'_tab_select_body_'+menuid).hide();
	    		}catch(e){}
			});
			//---------------关闭其它------------------------------------------------------
			$(self.id+'_tab_select_body_otherclose_'+menuid).observe('click',function(a){
				try{
	    			if(self.optab!=menuid){
	    				self.SelectTabmenu(menuid);
	    			}
	    		}catch(e){}
				 self.delLeftRab();
				 self.delRightRab();
				try{
		    		$(self.id+'_tab_select_body_'+menuid).hide();
		    	}catch(e){}
			});
			//---------------关闭右边------------------------------------------------
			$(self.id+'_tab_select_body_rightclose_'+menuid).observe('click',function(a){
				try{
	    			if(self.optab!=menuid){
	    				self.SelectTabmenu(menuid);
	    			}
	    		}catch(e){}
				self.delRightRab();
				try{
	    			$(self.id+'_tab_select_body_'+menuid).hide();
	    		}catch(e){}
			});
			//---------------鼠标经过颜色---------------------------------------------
			$(self.id+'_tab_select_body_tr_reload_'+menuid).observe('mousemove',function(a){
				$(self.id+'_tab_select_body_tr_reload_'+menuid).removeClassName('table_options');
				$(self.id+'_tab_select_body_tr_reload_'+menuid).addClassName('table_options_hover');
	    	});
			$(self.id+'_tab_select_body_tr_reload_'+menuid).observe('mouseout',function(a){
				$(self.id+'_tab_select_body_tr_reload_'+menuid).removeClassName('table_options_hover');
				$(self.id+'_tab_select_body_tr_reload_'+menuid).addClassName('table_options');
	    	});
	    	
			$(self.id+'_tab_select_body_tr_myclose_'+menuid).observe('mousemove',function(a){
				$(self.id+'_tab_select_body_tr_myclose_'+menuid).removeClassName('table_options');
				$(self.id+'_tab_select_body_tr_myclose_'+menuid).addClassName('table_options_hover');
	    	});
			$(self.id+'_tab_select_body_tr_myclose_'+menuid).observe('mouseout',function(a){
				$(self.id+'_tab_select_body_tr_myclose_'+menuid).removeClassName('table_options_hover');
				$(self.id+'_tab_select_body_tr_myclose_'+menuid).addClassName('table_options');
	    	});
			
			$(self.id+'_tab_select_body_tr_leftclose_'+menuid).observe('mousemove',function(a){
				$(self.id+'_tab_select_body_tr_leftclose_'+menuid).removeClassName('table_options');
				$(self.id+'_tab_select_body_tr_leftclose_'+menuid).addClassName('table_options_hover');
	    	});
			$(self.id+'_tab_select_body_tr_leftclose_'+menuid).observe('mouseout',function(a){
				$(self.id+'_tab_select_body_tr_leftclose_'+menuid).removeClassName('table_options_hover');
				$(self.id+'_tab_select_body_tr_leftclose_'+menuid).addClassName('table_options');
	    	});
			
			$(self.id+'_tab_select_body_tr_otherclose_'+menuid).observe('mousemove',function(a){
				$(self.id+'_tab_select_body_tr_otherclose_'+menuid).removeClassName('table_options');
				$(self.id+'_tab_select_body_tr_otherclose_'+menuid).addClassName('table_options_hover');
	    	});
			$(self.id+'_tab_select_body_tr_otherclose_'+menuid).observe('mouseout',function(a){
				$(self.id+'_tab_select_body_tr_otherclose_'+menuid).removeClassName('table_options_hover');
				$(self.id+'_tab_select_body_tr_otherclose_'+menuid).addClassName('table_options');
	    	});
			
			$(self.id+'_tab_select_body_tr_rightclose_'+menuid).observe('mousemove',function(a){
				$(self.id+'_tab_select_body_tr_rightclose_'+menuid).removeClassName('table_options');
				$(self.id+'_tab_select_body_tr_rightclose_'+menuid).addClassName('table_options_hover');
	    	});
			$(self.id+'_tab_select_body_tr_rightclose_'+menuid).observe('mouseout',function(a){
				$(self.id+'_tab_select_body_tr_rightclose_'+menuid).removeClassName('table_options_hover');
				$(self.id+'_tab_select_body_tr_rightclose_'+menuid).addClassName('table_options');
	    	});
			//--------------显示---------------------------------------------------
			var tabSelect = $(self.id+'_tab_select_body_'+menuid);
			var tab = $(self.id+'_tdiv_button_'+menuid);
			var title=$(self.id+'_tdiv_button_'+menuid);
			var atop = tab.positionedOffset().top+tab.offsetHeight;
			var xleft = $(self.id+'_div_title').scrollLeft;
    		var aleft = tab.positionedOffset().left-xleft;
    		
			tabSelect.show();
			tabSelect.setStyle({top:atop+'px',left:aleft+'px'});
			
			title.observe('mousemove',function(){
	    		miFlg = true;
	    	});
			title.observe('mouseout',function(event){
	        	miFlg = false;
	        	var element = event.element();
	        	setTimeout(function(){
	                if (element.descendantOf($(self.id)) && !miFlg){
	                	tabSelect.hide();
	                }
	            },500);
			});
			
			tabSelect.observe('mousemove',function(){
	    		miFlg = true;
	    	});
			tabSelect.observe('mouseout',function(event){
	        	miFlg = false;
	        	var element = event.element();
	        	setTimeout(function(){
	                if (element.descendantOf($(self.id)) && !miFlg){
	                	tabSelect.hide();
	                }
	            },500);
			});
	    },
	    //--------------关闭------------------------------------------------------------
	    closeBody : function(menuid){
	    	var self = this;
	    	var idx = self.ptabs.indexOf(menuid);
	    	var closeButton = $(self.id+'_select_close_button_'+menuid);//关闭按钮
	    	if(closeButton.visible()){//关闭按钮可见
		    	self.ptabs.splice(idx,1);
		    	$(self.id+'_tdiv_button_'+menuid).remove();
		    	$(self.id+'_body_iframe_'+menuid).remove();
		    	$(self.id+'_select_options_tr_'+menuid).remove();
		    	if(self.optab == menuid){//当前卡是选种状态
		    		if(undefined!=self.ptabs[idx]){
		    			self.SelectTabmenu(self.ptabs[idx]);
		    		}else if(undefined!=self.ptabs[idx-1]){
		    			self.SelectTabmenu(self.ptabs[idx-1]);
		    		}
		    	}
		    	self.resetListHeight();
	    	}
	    }
 });